package ruide_info_mvc.base.model.response;

import ruide_info_mvc.base.constant.ResponseConstant;

/**
 * 公共返回Bean
 * @ClassName BaseResponseBean
 * @Author wangBo
 * @Date 2019/7/20 0020 下午 8:39
 * @Version 1.0
 */
public class BaseResponseBean {

    protected int code;

    protected String message;

    protected Object value;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public BaseResponseBean() {
        this.code = ResponseConstant.OK;
        this.message = ResponseConstant.REQUESTSUCCESS;
    }

    /**
     * 功能描述: 构建错误的返回对象
     * @Author wangBo
     * @Date 2019/7/1 0001 下午 5:01
     * @param message
     * @return BaseResultBean
     **/
    public static BaseResponseBean buildError(String message) {
        BaseResponseBean baseResultBean = new BaseResponseBean();
        baseResultBean.setCode(ResponseConstant.ERROR);
        baseResultBean.setMessage(message);
        return baseResultBean;
    }

    /**
     * 功能描述: 构建错误的返回对象
     * @Author wangBo
     * @Date 2019/7/1 0001 下午 5:01
     * @param message
     * @return BaseResultBean
     **/
    public static BaseResponseBean buildError(int errorCode , String message) {
        BaseResponseBean baseResultBean = new BaseResponseBean();
        baseResultBean.setCode(ResponseConstant.ERROR);
        baseResultBean.setMessage(message);
        return baseResultBean;
    }

    /**
     * 功能描述: 构建成功的对象
     * @Author wangBo
     * @Date 2019/7/1 0001 下午 5:17
     * @param message
     * @param value
     * @return baseResultBean
     **/
    public static BaseResponseBean buildSeccsec(String message,Object value) {
        BaseResponseBean baseResultBean = new BaseResponseBean();
        baseResultBean.setCode(ResponseConstant.OK);
        baseResultBean.setMessage(message);
        baseResultBean.setValue(value);
        return baseResultBean;
    }
}